package org.jeecg.modules.demo.hd.service.impl;

import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import org.jeecg.modules.demo.hd.entity.AppYinsixieyi;
import org.jeecg.modules.demo.hd.mapper.AppYinsixieyiMapper;
import org.jeecg.modules.demo.hd.service.IAppYinsixieyiService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description: app_yinsixieyi
 * @Author: jeecg-boot
 * @Date: 2025-02-09
 * @Version: V1.0
 */
@Service
public class AppYinsixieyiServiceImpl extends ServiceImpl<AppYinsixieyiMapper, AppYinsixieyi> implements IAppYinsixieyiService {


    @Override
    public String queryOne() {
        List<AppYinsixieyi> list = this.baseMapper.selectList(null);
        List<AppYinsixieyi> collect = list.stream().filter(x -> "0".equals(x.getNoteType()) && x.getNoteState() == 0).collect(Collectors.toList());
        if (ObjectUtils.isNotNull(collect) && collect.size() > 0) {
            return collect.get(0).getDescription();
        }
        return "";
    }

    @Override
    public String queryOne(String noteType) {
        List<AppYinsixieyi> list = this.baseMapper.selectList(null);
        List<AppYinsixieyi> collect = list.stream().filter(x -> noteType.equals(x.getNoteType()) && x.getNoteState() == 0).collect(Collectors.toList());
        if (ObjectUtils.isNotNull(collect) && collect.size() > 0) {
            return collect.get(0).getDescription();
        }
        return "";
    }


}
